package com.beyondsoft.common.core.exchange.sender;

import com.beyondsoft.common.core.exchange.model.Message;
import com.beyondsoft.common.core.sys.initialization.RabbitConfig;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 主线程通知
 */
@Component
public class MainToSubSender {

    @Autowired
    private AmqpTemplate rabbitTemplate;

    /**
     * 通知所有远程处理事务
     *
     * @param message
     */
    public void send(Message message) {
        System.out.println("发送处理通知");
        this.rabbitTemplate.convertAndSend(RabbitConfig.FANOUT_EXCHANGE, "", message);
    }

}